package com.vsen.lpr.controller;

import com.vsen.lpr.common.base.BaseController;
import com.vsen.lpr.common.model.MinioItem;
import com.vsen.lpr.common.model.Response;
import com.vsen.lpr.common.utils.MinioTemplate;
import com.vsen.lpr.pojo.dto.BannerDto;
import com.vsen.lpr.pojo.dto.InsertBannerDto;
import com.vsen.lpr.pojo.dto.measure.InsertUserMeasureRecordDto;
import com.vsen.lpr.pojo.dto.measure.MeansureListDto;
import com.vsen.lpr.pojo.vo.UserMeasureHistoryVo;
import com.vsen.lpr.service.BannerService;
import com.vsen.lpr.service.MeasureService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.ParseException;
import java.util.List;

@Controller
@RequestMapping("/banner")
@Slf4j
public class BannerController extends BaseController {

    @Autowired
    private BannerService bannerService;

    /**
     * 插入测量数据
     *
     * @param dto
     * @return
     */
    @PostMapping("/insert")
    @ResponseBody
    Response insertBanner(@RequestBody InsertBannerDto dto) {
        return bannerService.insertBanner(dto);
    }

    /**
     * 轮播图列表
     *
     * @param dto
     * @return
     */
    @PostMapping("/bannerList")
    @ResponseBody
    Response<List<String>> bannerList(@RequestBody BannerDto dto,BindingResult bindingResult) {
        checkParameters(bindingResult);
        return bannerService.bannerList(dto);
    }
}
